package cn.ee.dfs.lotto.service.impl;

import cn.ee.dfs.common.entity.QueryRequest;
import cn.ee.dfs.common.utils.DateUtil;
import cn.ee.dfs.lotto.lottery.SuperLottery;
import cn.ee.dfs.lotto.mapper.SuperLotteryMapper;
import cn.ee.dfs.lotto.service.ISuperLotteryService;
import cn.ee.dfs.wx.OkHttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 大乐透 Service实现
 *
 * @author TWJ
 * @date 2024-02-04 16:18:29
 */
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class SuperLotteryServiceImpl extends ServiceImpl<SuperLotteryMapper, SuperLottery> implements ISuperLotteryService {

    @Autowired
    private SuperLotteryMapper superLotteryMapper;

    @Override
    public IPage<SuperLottery> findSuperLotterys(QueryRequest request, SuperLottery superLottery) {
        LambdaQueryWrapper<SuperLottery> queryWrapper = new LambdaQueryWrapper<>();
        // TODO 设置查询条件
        Page<SuperLottery> page = new Page<>(request.getPageNum(), request.getPageSize());
        return this.page(page, queryWrapper);
    }

    @Override
    public List<SuperLottery> findSuperLotterys(SuperLottery superLottery) {
        LambdaQueryWrapper<SuperLottery> queryWrapper = new LambdaQueryWrapper<>();
        // TODO 设置查询条件
        return this.baseMapper.selectList(queryWrapper);
    }

    @Override
    @Transactional
    public void createSuperLottery(SuperLottery superLottery) {
        this.save(superLottery);
    }

    @Override
    @Transactional
    public void updateSuperLottery(SuperLottery superLottery) {
        this.saveOrUpdate(superLottery);
    }

    @Override
    @Transactional
    public void deleteSuperLottery(SuperLottery superLottery) {
        LambdaQueryWrapper<SuperLottery> wapper = new LambdaQueryWrapper<>();
        // TODO 设置删除条件
        this.remove(wapper);
    }

    @Resource
    private OkHttpUtil httpUtil;

    @Override
    @Transactional
    public void pullSuperLotteryData(Map<String, Object> queryParam) {
        String url = "https://webapi.sporttery.cn/gateway/lottery/getHistoryPageListV1.qry?gameNo=85&provinceId=0&isVerify=1";
//        String url = "https://webapi.sporttery.cn/gateway/lottery/getHistoryPageListV1.qry?gameNo=85&provinceId=0&pageSize=10&isVerify=1&pageNo=1&startTerm=09001&endTerm=10001";

        HashMap<String, String> queries = new HashMap<>();
        queries.put("pageSize", String.valueOf(queryParam.get("pageSize")));
        queries.put("pageNo", String.valueOf(queryParam.get("pageNo")));
        queries.put("startTerm", String.valueOf(queryParam.get("startTerm")));//07001
        queries.put("endTerm", String.valueOf(queryParam.get("endTerm")));//08001

        String result = httpUtil.get(url, queries);
        System.out.println("result = " + result);
//        result = "{\"dataFrom\":\"\",\"emptyFlag\":false,\"errorCode\":\"0\",\"errorMessage\":\"处理成功\",\"success\":true,\"value\":{\"lastPoolDraw\":{\"lotteryDrawNum\":\"08001\",\"lotteryDrawResult\":\"01 02 11 34 35 03 10\",\"lotteryDrawTime\":\"2008-01-02\",\"lotteryGameName\":\"超级大乐透\",\"lotteryGameNum\":\"85\",\"poolBalanceAfterdraw\":\"0\",\"prizeLevelList\":[{\"awardType\":0,\"group\":\"\",\"lotteryCondition\":\"\",\"prizeLevel\":\"三等奖(追加)\",\"sort\":60,\"stakeAmount\":\"1,800\",\"stakeAmountFormat\":\"1800\",\"stakeCount\":\"26\",\"totalPrizeamount\":\"46,800\"},{\"awardType\":0,\"group\":\"\",\"lotteryCondition\":\"\",\"prizeLevel\":\"四等奖(追加)\",\"sort\":80,\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"stakeCount\":\"134\",\"totalPrizeamount\":\"402,000\"},{\"awardType\":0,\"group\":\"\",\"lotteryCondition\":\"\",\"prizeLevel\":\"五等奖(追加)\",\"sort\":100,\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"stakeCount\":\"2,978\",\"totalPrizeamount\":\"1,489,000\"},{\"awardType\":0,\"group\":\"101\",\"lotteryCondition\":\"\",\"prizeLevel\":\"一等奖\",\"sort\":101,\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"stakeCount\":\"0\",\"totalPrizeamount\":\"0\"},{\"awardType\":0,\"group\":\"201\",\"lotteryCondition\":\"\",\"prizeLevel\":\"一等奖(追加)\",\"sort\":201,\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"stakeCount\":\"0\",\"totalPrizeamount\":\"0\"},{\"awardType\":0,\"group\":\"301\",\"lotteryCondition\":\"\",\"prizeLevel\":\"二等奖\",\"sort\":301,\"stakeAmount\":\"129,903\",\"stakeAmountFormat\":\"129903\",\"stakeCount\":\"36\",\"totalPrizeamount\":\"4,676,508\"},{\"awardType\":0,\"group\":\"401\",\"lotteryCondition\":\"\",\"prizeLevel\":\"二等奖(追加)\",\"sort\":401,\"stakeAmount\":\"77,941\",\"stakeAmountFormat\":\"77941\",\"stakeCount\":\"6\",\"totalPrizeamount\":\"467,646\"},{\"awardType\":0,\"group\":\"501\",\"lotteryCondition\":\"\",\"prizeLevel\":\"三等奖\",\"sort\":501,\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"stakeCount\":\"111\",\"totalPrizeamount\":\"333,000\"},{\"awardType\":0,\"group\":\"601\",\"lotteryCondition\":\"\",\"prizeLevel\":\"四等奖\",\"sort\":601,\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"stakeCount\":\"134\",\"totalPrizeamount\":\"402,000\"},{\"awardType\":0,\"group\":\"701\",\"lotteryCondition\":\"\",\"prizeLevel\":\"五等奖\",\"sort\":701,\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"stakeCount\":\"2,978\",\"totalPrizeamount\":\"1,489,000\"},{\"awardType\":0,\"group\":\"801\",\"lotteryCondition\":\"\",\"prizeLevel\":\"六等奖\",\"sort\":801,\"stakeAmount\":\"200\",\"stakeAmountFormat\":\"200\",\"stakeCount\":\"16,286\",\"totalPrizeamount\":\"3,257,200\"}]},\"list\":[{\"lotteryGameName\":\"超级大乐透\",\"lotteryGameNum\":\"85\",\"lotteryDrawNum\":\"08001\",\"lotteryDrawResult\":\"01 02 11 34 35 03 10\",\"lotterySuspendedFlag\":0,\"lotteryDrawStatus\":20,\"lotterySaleEndtime\":\"2008-01-02 19:00:00\",\"lotterySaleBeginTime\":\"2008-01-01 19:00:00\",\"lotterySaleEndTimeUnix\":{},\"lotteryDrawTime\":\"2008-01-02\",\"lotteryPaidBeginTime\":\"\",\"lotteryPaidEndTime\":\"\",\"estimateDrawTime\":\"\",\"verify\":1,\"lotteryPromotionFlag\":0,\"isGetKjpdf\":1,\"isGetXlpdf\":2,\"pdfType\":4,\"lotteryUnsortDrawresult\":{},\"poolBalanceAfterdraw\":\"0\",\"poolBalanceAfterdrawRj\":\"\",\"drawFlowFund\":\"\",\"drawFlowFundRj\":\"\",\"totalSaleAmount\":\"\",\"totalSaleAmountRj\":\"\",\"lotteryEquipmentCount\":0,\"lotteryGamePronum\":0,\"matchList\":[],\"prizeLevelList\":[{\"prizeLevel\":\"三等奖(追加)\",\"stakeCount\":\"26\",\"stakeAmount\":\"1,800\",\"stakeAmountFormat\":\"1800\",\"totalPrizeamount\":\"46,800\",\"sort\":60,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"四等奖(追加)\",\"stakeCount\":\"134\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"402,000\",\"sort\":80,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"五等奖(追加)\",\"stakeCount\":\"2,978\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"1,489,000\",\"sort\":100,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"一等奖\",\"stakeCount\":\"0\",\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"totalPrizeamount\":\"0\",\"sort\":101,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"101\"},{\"prizeLevel\":\"一等奖(追加)\",\"stakeCount\":\"0\",\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"totalPrizeamount\":\"0\",\"sort\":201,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"201\"},{\"prizeLevel\":\"二等奖\",\"stakeCount\":\"36\",\"stakeAmount\":\"129,903\",\"stakeAmountFormat\":\"129903\",\"totalPrizeamount\":\"4,676,508\",\"sort\":301,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"301\"},{\"prizeLevel\":\"二等奖(追加)\",\"stakeCount\":\"6\",\"stakeAmount\":\"77,941\",\"stakeAmountFormat\":\"77941\",\"totalPrizeamount\":\"467,646\",\"sort\":401,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"401\"},{\"prizeLevel\":\"三等奖\",\"stakeCount\":\"111\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"333,000\",\"sort\":501,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"501\"},{\"prizeLevel\":\"四等奖\",\"stakeCount\":\"134\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"402,000\",\"sort\":601,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"601\"},{\"prizeLevel\":\"五等奖\",\"stakeCount\":\"2,978\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"1,489,000\",\"sort\":701,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"701\"},{\"prizeLevel\":\"六等奖\",\"stakeCount\":\"16,286\",\"stakeAmount\":\"200\",\"stakeAmountFormat\":\"200\",\"totalPrizeamount\":\"3,257,200\",\"sort\":801,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"801\"}],\"prizeLevelListRj\":[],\"termList\":[],\"termResultList\":[],\"ruleType\":0,\"vtoolsConfig\":{},\"surplusAmount\":\"\",\"surplusAmountRj\":\"\",\"lotteryPromotionFlagRj\":0,\"drawPdfUrl\":\"https://pdf.sporttery.cn/33800/08001/08001.pdf\",\"lotteryNotice\":1,\"lotteryDrawStatusNo\":\"\",\"lotteryNoticeShowFlag\":1},{\"lotteryGameName\":\"超级大乐透\",\"lotteryGameNum\":\"85\",\"lotteryDrawNum\":\"07093\",\"lotteryDrawResult\":\"06 08 16 25 27 08 12\",\"lotterySuspendedFlag\":0,\"lotteryDrawStatus\":20,\"lotterySaleEndtime\":\"2007-12-31 19:00:00\",\"lotterySaleBeginTime\":\"2007-12-30 19:00:00\",\"lotterySaleEndTimeUnix\":{},\"lotteryDrawTime\":\"2007-12-31\",\"lotteryPaidBeginTime\":\"\",\"lotteryPaidEndTime\":\"\",\"estimateDrawTime\":\"\",\"verify\":1,\"lotteryPromotionFlag\":0,\"isGetKjpdf\":1,\"isGetXlpdf\":2,\"pdfType\":4,\"lotteryUnsortDrawresult\":{},\"poolBalanceAfterdraw\":\"0\",\"poolBalanceAfterdrawRj\":\"\",\"drawFlowFund\":\"\",\"drawFlowFundRj\":\"\",\"totalSaleAmount\":\"\",\"totalSaleAmountRj\":\"\",\"lotteryEquipmentCount\":0,\"lotteryGamePronum\":0,\"matchList\":[],\"prizeLevelList\":[{\"prizeLevel\":\"三等奖(追加)\",\"stakeCount\":\"4\",\"stakeAmount\":\"22,921\",\"stakeAmountFormat\":\"22921\",\"totalPrizeamount\":\"91,684\",\"sort\":60,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"四等奖(追加)\",\"stakeCount\":\"64\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"192,000\",\"sort\":80,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"五等奖(追加)\",\"stakeCount\":\"2,082\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"1,041,000\",\"sort\":100,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"一等奖\",\"stakeCount\":\"0\",\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"totalPrizeamount\":\"0\",\"sort\":101,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"101\"},{\"prizeLevel\":\"一等奖(追加)\",\"stakeCount\":\"0\",\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"totalPrizeamount\":\"0\",\"sort\":201,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"201\"},{\"prizeLevel\":\"二等奖\",\"stakeCount\":\"18\",\"stakeAmount\":\"120,638\",\"stakeAmountFormat\":\"120638\",\"totalPrizeamount\":\"2,171,484\",\"sort\":301,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"301\"},{\"prizeLevel\":\"二等奖(追加)\",\"stakeCount\":\"8\",\"stakeAmount\":\"72,382\",\"stakeAmountFormat\":\"72382\",\"totalPrizeamount\":\"579,056\",\"sort\":401,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"401\"},{\"prizeLevel\":\"三等奖\",\"stakeCount\":\"12\",\"stakeAmount\":\"38,202\",\"stakeAmountFormat\":\"38202\",\"totalPrizeamount\":\"458,424\",\"sort\":501,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"501\"},{\"prizeLevel\":\"四等奖\",\"stakeCount\":\"64\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"192,000\",\"sort\":601,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"601\"},{\"prizeLevel\":\"五等奖\",\"stakeCount\":\"2,082\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"1,041,000\",\"sort\":701,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"701\"},{\"prizeLevel\":\"六等奖\",\"stakeCount\":\"7,078\",\"stakeAmount\":\"200\",\"stakeAmountFormat\":\"200\",\"totalPrizeamount\":\"1,415,600\",\"sort\":801,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"801\"}],\"prizeLevelListRj\":[],\"termList\":[],\"termResultList\":[],\"ruleType\":0,\"vtoolsConfig\":{},\"surplusAmount\":\"\",\"surplusAmountRj\":\"\",\"lotteryPromotionFlagRj\":0,\"drawPdfUrl\":\"https://pdf.sporttery.cn/33800/07093/07093.pdf\",\"lotteryNotice\":1,\"lotteryDrawStatusNo\":\"\",\"lotteryNoticeShowFlag\":1},{\"lotteryGameName\":\"超级大乐透\",\"lotteryGameNum\":\"85\",\"lotteryDrawNum\":\"07092\",\"lotteryDrawResult\":\"06 19 27 28 29 06 10\",\"lotterySuspendedFlag\":0,\"lotteryDrawStatus\":20,\"lotterySaleEndtime\":\"2007-12-29 19:00:00\",\"lotterySaleBeginTime\":\"2007-12-28 19:00:00\",\"lotterySaleEndTimeUnix\":{},\"lotteryDrawTime\":\"2007-12-29\",\"lotteryPaidBeginTime\":\"\",\"lotteryPaidEndTime\":\"\",\"estimateDrawTime\":\"\",\"verify\":1,\"lotteryPromotionFlag\":0,\"isGetKjpdf\":1,\"isGetXlpdf\":2,\"pdfType\":4,\"lotteryUnsortDrawresult\":{},\"poolBalanceAfterdraw\":\"0\",\"poolBalanceAfterdrawRj\":\"\",\"drawFlowFund\":\"\",\"drawFlowFundRj\":\"\",\"totalSaleAmount\":\"\",\"totalSaleAmountRj\":\"\",\"lotteryEquipmentCount\":0,\"lotteryGamePronum\":0,\"matchList\":[],\"prizeLevelList\":[{\"prizeLevel\":\"三等奖(追加)\",\"stakeCount\":\"16\",\"stakeAmount\":\"4,427\",\"stakeAmountFormat\":\"4427\",\"totalPrizeamount\":\"70,832\",\"sort\":60,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"四等奖(追加)\",\"stakeCount\":\"16\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"48,000\",\"sort\":80,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"五等奖(追加)\",\"stakeCount\":\"156\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"78,000\",\"sort\":100,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"一等奖\",\"stakeCount\":\"1\",\"stakeAmount\":\"6,940,785\",\"stakeAmountFormat\":\"6940785\",\"totalPrizeamount\":\"6,940,785\",\"sort\":101,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"101\"},{\"prizeLevel\":\"一等奖(追加)\",\"stakeCount\":\"0\",\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"totalPrizeamount\":\"0\",\"sort\":201,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"201\"},{\"prizeLevel\":\"二等奖\",\"stakeCount\":\"15\",\"stakeAmount\":\"292,161\",\"stakeAmountFormat\":\"292161\",\"totalPrizeamount\":\"4,382,415\",\"sort\":301,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"301\"},{\"prizeLevel\":\"二等奖(追加)\",\"stakeCount\":\"6\",\"stakeAmount\":\"175,296\",\"stakeAmountFormat\":\"175296\",\"totalPrizeamount\":\"1,051,776\",\"sort\":401,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"401\"},{\"prizeLevel\":\"三等奖\",\"stakeCount\":\"43\",\"stakeAmount\":\"7,379\",\"stakeAmountFormat\":\"7379\",\"totalPrizeamount\":\"317,297\",\"sort\":501,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"501\"},{\"prizeLevel\":\"四等奖\",\"stakeCount\":\"16\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"48,000\",\"sort\":601,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"601\"},{\"prizeLevel\":\"五等奖\",\"stakeCount\":\"156\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"78,000\",\"sort\":701,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"701\"},{\"prizeLevel\":\"六等奖\",\"stakeCount\":\"4,605\",\"stakeAmount\":\"200\",\"stakeAmountFormat\":\"200\",\"totalPrizeamount\":\"921,000\",\"sort\":801,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"801\"}],\"prizeLevelListRj\":[],\"termList\":[],\"termResultList\":[],\"ruleType\":0,\"vtoolsConfig\":{},\"surplusAmount\":\"\",\"surplusAmountRj\":\"\",\"lotteryPromotionFlagRj\":0,\"drawPdfUrl\":\"https://pdf.sporttery.cn/33800/07092/07092.pdf\",\"lotteryNotice\":1,\"lotteryDrawStatusNo\":\"\",\"lotteryNoticeShowFlag\":1},{\"lotteryGameName\":\"超级大乐透\",\"lotteryGameNum\":\"85\",\"lotteryDrawNum\":\"07091\",\"lotteryDrawResult\":\"07 12 26 31 32 03 08\",\"lotterySuspendedFlag\":0,\"lotteryDrawStatus\":20,\"lotterySaleEndtime\":\"2007-12-26 19:00:00\",\"lotterySaleBeginTime\":\"2007-12-25 19:00:00\",\"lotterySaleEndTimeUnix\":{},\"lotteryDrawTime\":\"2007-12-26\",\"lotteryPaidBeginTime\":\"\",\"lotteryPaidEndTime\":\"\",\"estimateDrawTime\":\"\",\"verify\":1,\"lotteryPromotionFlag\":0,\"isGetKjpdf\":1,\"isGetXlpdf\":2,\"pdfType\":4,\"lotteryUnsortDrawresult\":{},\"poolBalanceAfterdraw\":\"0\",\"poolBalanceAfterdrawRj\":\"\",\"drawFlowFund\":\"\",\"drawFlowFundRj\":\"\",\"totalSaleAmount\":\"\",\"totalSaleAmountRj\":\"\",\"lotteryEquipmentCount\":0,\"lotteryGamePronum\":0,\"matchList\":[],\"prizeLevelList\":[{\"prizeLevel\":\"三等奖(追加)\",\"stakeCount\":\"14\",\"stakeAmount\":\"2,357\",\"stakeAmountFormat\":\"2357\",\"totalPrizeamount\":\"32,998\",\"sort\":60,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"四等奖(追加)\",\"stakeCount\":\"515\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"1,545,000\",\"sort\":80,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"五等奖(追加)\",\"stakeCount\":\"3,880\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"1,940,000\",\"sort\":100,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"一等奖\",\"stakeCount\":\"3\",\"stakeAmount\":\"5,236,878\",\"stakeAmountFormat\":\"5236878\",\"totalPrizeamount\":\"15,710,634\",\"sort\":101,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"101\"},{\"prizeLevel\":\"一等奖(追加)\",\"stakeCount\":\"1\",\"stakeAmount\":\"3,142,126\",\"stakeAmountFormat\":\"3142126\",\"totalPrizeamount\":\"3,142,126\",\"sort\":201,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"201\"},{\"prizeLevel\":\"二等奖\",\"stakeCount\":\"20\",\"stakeAmount\":\"106,595\",\"stakeAmountFormat\":\"106595\",\"totalPrizeamount\":\"2,131,900\",\"sort\":301,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"301\"},{\"prizeLevel\":\"二等奖(追加)\",\"stakeCount\":\"4\",\"stakeAmount\":\"63,957\",\"stakeAmountFormat\":\"63957\",\"totalPrizeamount\":\"255,828\",\"sort\":401,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"401\"},{\"prizeLevel\":\"三等奖\",\"stakeCount\":\"35\",\"stakeAmount\":\"3,929\",\"stakeAmountFormat\":\"3929\",\"totalPrizeamount\":\"137,515\",\"sort\":501,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"501\"},{\"prizeLevel\":\"四等奖\",\"stakeCount\":\"515\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"1,545,000\",\"sort\":601,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"601\"},{\"prizeLevel\":\"五等奖\",\"stakeCount\":\"3,880\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"1,940,000\",\"sort\":701,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"701\"},{\"prizeLevel\":\"六等奖\",\"stakeCount\":\"18,919\",\"stakeAmount\":\"200\",\"stakeAmountFormat\":\"200\",\"totalPrizeamount\":\"3,783,800\",\"sort\":801,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"801\"}],\"prizeLevelListRj\":[],\"termList\":[],\"termResultList\":[],\"ruleType\":0,\"vtoolsConfig\":{},\"surplusAmount\":\"\",\"surplusAmountRj\":\"\",\"lotteryPromotionFlagRj\":0,\"drawPdfUrl\":\"https://pdf.sporttery.cn/33800/07091/07091.pdf\",\"lotteryNotice\":1,\"lotteryDrawStatusNo\":\"\",\"lotteryNoticeShowFlag\":1},{\"lotteryGameName\":\"超级大乐透\",\"lotteryGameNum\":\"85\",\"lotteryDrawNum\":\"07090\",\"lotteryDrawResult\":\"04 20 24 31 33 09 12\",\"lotterySuspendedFlag\":0,\"lotteryDrawStatus\":20,\"lotterySaleEndtime\":\"2007-12-24 19:00:00\",\"lotterySaleBeginTime\":\"2007-12-23 19:00:00\",\"lotterySaleEndTimeUnix\":{},\"lotteryDrawTime\":\"2007-12-24\",\"lotteryPaidBeginTime\":\"\",\"lotteryPaidEndTime\":\"\",\"estimateDrawTime\":\"\",\"verify\":1,\"lotteryPromotionFlag\":0,\"isGetKjpdf\":1,\"isGetXlpdf\":2,\"pdfType\":4,\"lotteryUnsortDrawresult\":{},\"poolBalanceAfterdraw\":\"0\",\"poolBalanceAfterdrawRj\":\"\",\"drawFlowFund\":\"\",\"drawFlowFundRj\":\"\",\"totalSaleAmount\":\"\",\"totalSaleAmountRj\":\"\",\"lotteryEquipmentCount\":0,\"lotteryGamePronum\":0,\"matchList\":[],\"prizeLevelList\":[{\"prizeLevel\":\"三等奖(追加)\",\"stakeCount\":\"13\",\"stakeAmount\":\"4,383\",\"stakeAmountFormat\":\"4383\",\"totalPrizeamount\":\"56,979\",\"sort\":60,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"四等奖(追加)\",\"stakeCount\":\"74\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"222,000\",\"sort\":80,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"五等奖(追加)\",\"stakeCount\":\"2,597\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"1,298,500\",\"sort\":100,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"一等奖\",\"stakeCount\":\"0\",\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"totalPrizeamount\":\"0\",\"sort\":101,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"101\"},{\"prizeLevel\":\"一等奖(追加)\",\"stakeCount\":\"0\",\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"totalPrizeamount\":\"0\",\"sort\":201,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"201\"},{\"prizeLevel\":\"二等奖\",\"stakeCount\":\"30\",\"stakeAmount\":\"203,444\",\"stakeAmountFormat\":\"203444\",\"totalPrizeamount\":\"6,103,320\",\"sort\":301,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"301\"},{\"prizeLevel\":\"二等奖(追加)\",\"stakeCount\":\"11\",\"stakeAmount\":\"122,066\",\"stakeAmountFormat\":\"122066\",\"totalPrizeamount\":\"1,342,726\",\"sort\":401,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"401\"},{\"prizeLevel\":\"三等奖\",\"stakeCount\":\"65\",\"stakeAmount\":\"7,305\",\"stakeAmountFormat\":\"7305\",\"totalPrizeamount\":\"474,825\",\"sort\":501,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"501\"},{\"prizeLevel\":\"四等奖\",\"stakeCount\":\"74\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"222,000\",\"sort\":601,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"601\"},{\"prizeLevel\":\"五等奖\",\"stakeCount\":\"2,597\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"1,298,500\",\"sort\":701,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"701\"},{\"prizeLevel\":\"六等奖\",\"stakeCount\":\"9,113\",\"stakeAmount\":\"200\",\"stakeAmountFormat\":\"200\",\"totalPrizeamount\":\"1,822,600\",\"sort\":801,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"801\"}],\"prizeLevelListRj\":[],\"termList\":[],\"termResultList\":[],\"ruleType\":0,\"vtoolsConfig\":{},\"surplusAmount\":\"\",\"surplusAmountRj\":\"\",\"lotteryPromotionFlagRj\":0,\"drawPdfUrl\":\"https://pdf.sporttery.cn/33800/07090/07090.pdf\",\"lotteryNotice\":1,\"lotteryDrawStatusNo\":\"\",\"lotteryNoticeShowFlag\":1},{\"lotteryGameName\":\"超级大乐透\",\"lotteryGameNum\":\"85\",\"lotteryDrawNum\":\"07089\",\"lotteryDrawResult\":\"08 13 24 30 34 01 12\",\"lotterySuspendedFlag\":0,\"lotteryDrawStatus\":20,\"lotterySaleEndtime\":\"2007-12-22 19:00:00\",\"lotterySaleBeginTime\":\"2007-12-21 19:00:00\",\"lotterySaleEndTimeUnix\":{},\"lotteryDrawTime\":\"2007-12-22\",\"lotteryPaidBeginTime\":\"\",\"lotteryPaidEndTime\":\"\",\"estimateDrawTime\":\"\",\"verify\":1,\"lotteryPromotionFlag\":0,\"isGetKjpdf\":1,\"isGetXlpdf\":2,\"pdfType\":4,\"lotteryUnsortDrawresult\":{},\"poolBalanceAfterdraw\":\"0\",\"poolBalanceAfterdrawRj\":\"\",\"drawFlowFund\":\"\",\"drawFlowFundRj\":\"\",\"totalSaleAmount\":\"\",\"totalSaleAmountRj\":\"\",\"lotteryEquipmentCount\":0,\"lotteryGamePronum\":0,\"matchList\":[],\"prizeLevelList\":[{\"prizeLevel\":\"三等奖(追加)\",\"stakeCount\":\"22\",\"stakeAmount\":\"5,885\",\"stakeAmountFormat\":\"5885\",\"totalPrizeamount\":\"129,470\",\"sort\":60,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"四等奖(追加)\",\"stakeCount\":\"77\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"231,000\",\"sort\":80,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"五等奖(追加)\",\"stakeCount\":\"2,170\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"1,085,000\",\"sort\":100,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"一等奖\",\"stakeCount\":\"1\",\"stakeAmount\":\"7,952,689\",\"stakeAmountFormat\":\"7952689\",\"totalPrizeamount\":\"7,952,689\",\"sort\":101,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"101\"},{\"prizeLevel\":\"一等奖(追加)\",\"stakeCount\":\"0\",\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"totalPrizeamount\":\"0\",\"sort\":201,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"201\"},{\"prizeLevel\":\"二等奖\",\"stakeCount\":\"34\",\"stakeAmount\":\"162,746\",\"stakeAmountFormat\":\"162746\",\"totalPrizeamount\":\"5,533,364\",\"sort\":301,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"301\"},{\"prizeLevel\":\"二等奖(追加)\",\"stakeCount\":\"28\",\"stakeAmount\":\"97,647\",\"stakeAmountFormat\":\"97647\",\"totalPrizeamount\":\"2,734,116\",\"sort\":401,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"401\"},{\"prizeLevel\":\"三等奖\",\"stakeCount\":\"47\",\"stakeAmount\":\"9,809\",\"stakeAmountFormat\":\"9809\",\"totalPrizeamount\":\"461,023\",\"sort\":501,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"501\"},{\"prizeLevel\":\"四等奖\",\"stakeCount\":\"77\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"231,000\",\"sort\":601,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"601\"},{\"prizeLevel\":\"五等奖\",\"stakeCount\":\"2,170\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"1,085,000\",\"sort\":701,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"701\"},{\"prizeLevel\":\"六等奖\",\"stakeCount\":\"8,071\",\"stakeAmount\":\"200\",\"stakeAmountFormat\":\"200\",\"totalPrizeamount\":\"1,614,200\",\"sort\":801,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"801\"}],\"prizeLevelListRj\":[],\"termList\":[],\"termResultList\":[],\"ruleType\":0,\"vtoolsConfig\":{},\"surplusAmount\":\"\",\"surplusAmountRj\":\"\",\"lotteryPromotionFlagRj\":0,\"drawPdfUrl\":\"https://pdf.sporttery.cn/33800/07089/07089.pdf\",\"lotteryNotice\":1,\"lotteryDrawStatusNo\":\"\",\"lotteryNoticeShowFlag\":1},{\"lotteryGameName\":\"超级大乐透\",\"lotteryGameNum\":\"85\",\"lotteryDrawNum\":\"07088\",\"lotteryDrawResult\":\"17 18 21 23 33 06 10\",\"lotterySuspendedFlag\":0,\"lotteryDrawStatus\":20,\"lotterySaleEndtime\":\"2007-12-19 19:00:00\",\"lotterySaleBeginTime\":\"2007-12-18 19:00:00\",\"lotterySaleEndTimeUnix\":{},\"lotteryDrawTime\":\"2007-12-19\",\"lotteryPaidBeginTime\":\"\",\"lotteryPaidEndTime\":\"\",\"estimateDrawTime\":\"\",\"verify\":1,\"lotteryPromotionFlag\":0,\"isGetKjpdf\":1,\"isGetXlpdf\":2,\"pdfType\":4,\"lotteryUnsortDrawresult\":{},\"poolBalanceAfterdraw\":\"0\",\"poolBalanceAfterdrawRj\":\"\",\"drawFlowFund\":\"\",\"drawFlowFundRj\":\"\",\"totalSaleAmount\":\"\",\"totalSaleAmountRj\":\"\",\"lotteryEquipmentCount\":0,\"lotteryGamePronum\":0,\"matchList\":[],\"prizeLevelList\":[{\"prizeLevel\":\"三等奖(追加)\",\"stakeCount\":\"3\",\"stakeAmount\":\"23,237\",\"stakeAmountFormat\":\"23237\",\"totalPrizeamount\":\"69,711\",\"sort\":60,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"四等奖(追加)\",\"stakeCount\":\"86\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"258,000\",\"sort\":80,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"五等奖(追加)\",\"stakeCount\":\"2,236\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"1,118,000\",\"sort\":100,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"一等奖\",\"stakeCount\":\"0\",\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"totalPrizeamount\":\"0\",\"sort\":101,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"101\"},{\"prizeLevel\":\"一等奖(追加)\",\"stakeCount\":\"0\",\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"totalPrizeamount\":\"0\",\"sort\":201,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"201\"},{\"prizeLevel\":\"二等奖\",\"stakeCount\":\"4\",\"stakeAmount\":\"1,870,652\",\"stakeAmountFormat\":\"1870652\",\"totalPrizeamount\":\"7,482,608\",\"sort\":301,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"301\"},{\"prizeLevel\":\"二等奖(追加)\",\"stakeCount\":\"0\",\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"totalPrizeamount\":\"0\",\"sort\":401,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"401\"},{\"prizeLevel\":\"三等奖\",\"stakeCount\":\"12\",\"stakeAmount\":\"38,729\",\"stakeAmountFormat\":\"38729\",\"totalPrizeamount\":\"464,748\",\"sort\":501,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"501\"},{\"prizeLevel\":\"四等奖\",\"stakeCount\":\"86\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"258,000\",\"sort\":601,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"601\"},{\"prizeLevel\":\"五等奖\",\"stakeCount\":\"2,236\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"1,118,000\",\"sort\":701,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"701\"},{\"prizeLevel\":\"六等奖\",\"stakeCount\":\"6,856\",\"stakeAmount\":\"200\",\"stakeAmountFormat\":\"200\",\"totalPrizeamount\":\"1,371,200\",\"sort\":801,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"801\"}],\"prizeLevelListRj\":[],\"termList\":[],\"termResultList\":[],\"ruleType\":0,\"vtoolsConfig\":{},\"surplusAmount\":\"\",\"surplusAmountRj\":\"\",\"lotteryPromotionFlagRj\":0,\"drawPdfUrl\":\"https://pdf.sporttery.cn/33800/07088/07088.pdf\",\"lotteryNotice\":1,\"lotteryDrawStatusNo\":\"\",\"lotteryNoticeShowFlag\":1},{\"lotteryGameName\":\"超级大乐透\",\"lotteryGameNum\":\"85\",\"lotteryDrawNum\":\"07087\",\"lotteryDrawResult\":\"08 18 30 31 33 04 09\",\"lotterySuspendedFlag\":0,\"lotteryDrawStatus\":20,\"lotterySaleEndtime\":\"2007-12-17 19:00:00\",\"lotterySaleBeginTime\":\"2007-12-16 19:00:00\",\"lotterySaleEndTimeUnix\":{},\"lotteryDrawTime\":\"2007-12-17\",\"lotteryPaidBeginTime\":\"\",\"lotteryPaidEndTime\":\"\",\"estimateDrawTime\":\"\",\"verify\":1,\"lotteryPromotionFlag\":0,\"isGetKjpdf\":1,\"isGetXlpdf\":2,\"pdfType\":4,\"lotteryUnsortDrawresult\":{},\"poolBalanceAfterdraw\":\"0\",\"poolBalanceAfterdrawRj\":\"\",\"drawFlowFund\":\"\",\"drawFlowFundRj\":\"\",\"totalSaleAmount\":\"\",\"totalSaleAmountRj\":\"\",\"lotteryEquipmentCount\":0,\"lotteryGamePronum\":0,\"matchList\":[],\"prizeLevelList\":[{\"prizeLevel\":\"三等奖(追加)\",\"stakeCount\":\"11\",\"stakeAmount\":\"9,381\",\"stakeAmountFormat\":\"9381\",\"totalPrizeamount\":\"103,191\",\"sort\":60,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"四等奖(追加)\",\"stakeCount\":\"91\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"273,000\",\"sort\":80,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"五等奖(追加)\",\"stakeCount\":\"2,033\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"1,016,500\",\"sort\":100,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"一等奖\",\"stakeCount\":\"0\",\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"totalPrizeamount\":\"0\",\"sort\":101,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"101\"},{\"prizeLevel\":\"一等奖(追加)\",\"stakeCount\":\"0\",\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"totalPrizeamount\":\"0\",\"sort\":201,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"201\"},{\"prizeLevel\":\"二等奖\",\"stakeCount\":\"11\",\"stakeAmount\":\"516,222\",\"stakeAmountFormat\":\"516222\",\"totalPrizeamount\":\"5,678,442\",\"sort\":301,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"301\"},{\"prizeLevel\":\"二等奖(追加)\",\"stakeCount\":\"4\",\"stakeAmount\":\"309,733\",\"stakeAmountFormat\":\"309733\",\"totalPrizeamount\":\"1,238,932\",\"sort\":401,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"401\"},{\"prizeLevel\":\"三等奖\",\"stakeCount\":\"25\",\"stakeAmount\":\"15,636\",\"stakeAmountFormat\":\"15636\",\"totalPrizeamount\":\"390,900\",\"sort\":501,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"501\"},{\"prizeLevel\":\"四等奖\",\"stakeCount\":\"91\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"273,000\",\"sort\":601,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"601\"},{\"prizeLevel\":\"五等奖\",\"stakeCount\":\"2,033\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"1,016,500\",\"sort\":701,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"701\"},{\"prizeLevel\":\"六等奖\",\"stakeCount\":\"7,762\",\"stakeAmount\":\"200\",\"stakeAmountFormat\":\"200\",\"totalPrizeamount\":\"1,552,400\",\"sort\":801,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"801\"}],\"prizeLevelListRj\":[],\"termList\":[],\"termResultList\":[],\"ruleType\":0,\"vtoolsConfig\":{},\"surplusAmount\":\"\",\"surplusAmountRj\":\"\",\"lotteryPromotionFlagRj\":0,\"drawPdfUrl\":\"https://pdf.sporttery.cn/33800/07087/07087.pdf\",\"lotteryNotice\":1,\"lotteryDrawStatusNo\":\"\",\"lotteryNoticeShowFlag\":1},{\"lotteryGameName\":\"超级大乐透\",\"lotteryGameNum\":\"85\",\"lotteryDrawNum\":\"07086\",\"lotteryDrawResult\":\"14 18 19 26 28 03 09\",\"lotterySuspendedFlag\":0,\"lotteryDrawStatus\":20,\"lotterySaleEndtime\":\"2007-12-15 19:00:00\",\"lotterySaleBeginTime\":\"2007-12-14 19:00:00\",\"lotterySaleEndTimeUnix\":{},\"lotteryDrawTime\":\"2007-12-15\",\"lotteryPaidBeginTime\":\"\",\"lotteryPaidEndTime\":\"\",\"estimateDrawTime\":\"\",\"verify\":1,\"lotteryPromotionFlag\":0,\"isGetKjpdf\":1,\"isGetXlpdf\":2,\"pdfType\":4,\"lotteryUnsortDrawresult\":{},\"poolBalanceAfterdraw\":\"0\",\"poolBalanceAfterdrawRj\":\"\",\"drawFlowFund\":\"\",\"drawFlowFundRj\":\"\",\"totalSaleAmount\":\"\",\"totalSaleAmountRj\":\"\",\"lotteryEquipmentCount\":0,\"lotteryGamePronum\":0,\"matchList\":[],\"prizeLevelList\":[{\"prizeLevel\":\"三等奖(追加)\",\"stakeCount\":\"6\",\"stakeAmount\":\"13,396\",\"stakeAmountFormat\":\"13396\",\"totalPrizeamount\":\"80,376\",\"sort\":60,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"四等奖(追加)\",\"stakeCount\":\"147\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"441,000\",\"sort\":80,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"五等奖(追加)\",\"stakeCount\":\"2,248\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"1,124,000\",\"sort\":100,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"一等奖\",\"stakeCount\":\"0\",\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"totalPrizeamount\":\"0\",\"sort\":101,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"101\"},{\"prizeLevel\":\"一等奖(追加)\",\"stakeCount\":\"0\",\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"totalPrizeamount\":\"0\",\"sort\":201,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"201\"},{\"prizeLevel\":\"二等奖\",\"stakeCount\":\"21\",\"stakeAmount\":\"287,168\",\"stakeAmountFormat\":\"287168\",\"totalPrizeamount\":\"6,030,528\",\"sort\":301,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"301\"},{\"prizeLevel\":\"二等奖(追加)\",\"stakeCount\":\"6\",\"stakeAmount\":\"172,300\",\"stakeAmountFormat\":\"172300\",\"totalPrizeamount\":\"1,033,800\",\"sort\":401,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"401\"},{\"prizeLevel\":\"三等奖\",\"stakeCount\":\"19\",\"stakeAmount\":\"22,327\",\"stakeAmountFormat\":\"22327\",\"totalPrizeamount\":\"424,213\",\"sort\":501,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"501\"},{\"prizeLevel\":\"四等奖\",\"stakeCount\":\"147\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"441,000\",\"sort\":601,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"601\"},{\"prizeLevel\":\"五等奖\",\"stakeCount\":\"2,248\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"1,124,000\",\"sort\":701,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"701\"},{\"prizeLevel\":\"六等奖\",\"stakeCount\":\"8,709\",\"stakeAmount\":\"200\",\"stakeAmountFormat\":\"200\",\"totalPrizeamount\":\"1,741,800\",\"sort\":801,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"801\"}],\"prizeLevelListRj\":[],\"termList\":[],\"termResultList\":[],\"ruleType\":0,\"vtoolsConfig\":{},\"surplusAmount\":\"\",\"surplusAmountRj\":\"\",\"lotteryPromotionFlagRj\":0,\"drawPdfUrl\":\"https://pdf.sporttery.cn/33800/07086/07086.pdf\",\"lotteryNotice\":1,\"lotteryDrawStatusNo\":\"\",\"lotteryNoticeShowFlag\":1},{\"lotteryGameName\":\"超级大乐透\",\"lotteryGameNum\":\"85\",\"lotteryDrawNum\":\"07085\",\"lotteryDrawResult\":\"17 24 28 29 33 02 05\",\"lotterySuspendedFlag\":0,\"lotteryDrawStatus\":20,\"lotterySaleEndtime\":\"2007-12-12 19:00:00\",\"lotterySaleBeginTime\":\"2007-12-11 19:00:00\",\"lotterySaleEndTimeUnix\":{},\"lotteryDrawTime\":\"2007-12-12\",\"lotteryPaidBeginTime\":\"\",\"lotteryPaidEndTime\":\"\",\"estimateDrawTime\":\"\",\"verify\":1,\"lotteryPromotionFlag\":0,\"isGetKjpdf\":1,\"isGetXlpdf\":2,\"pdfType\":4,\"lotteryUnsortDrawresult\":{},\"poolBalanceAfterdraw\":\"0\",\"poolBalanceAfterdrawRj\":\"\",\"drawFlowFund\":\"\",\"drawFlowFundRj\":\"\",\"totalSaleAmount\":\"\",\"totalSaleAmountRj\":\"\",\"lotteryEquipmentCount\":0,\"lotteryGamePronum\":0,\"matchList\":[],\"prizeLevelList\":[{\"prizeLevel\":\"三等奖(追加)\",\"stakeCount\":\"10\",\"stakeAmount\":\"6,927\",\"stakeAmountFormat\":\"6927\",\"totalPrizeamount\":\"69,270\",\"sort\":60,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"四等奖(追加)\",\"stakeCount\":\"91\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"273,000\",\"sort\":80,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"五等奖(追加)\",\"stakeCount\":\"2,550\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"1,275,000\",\"sort\":100,\"awardType\":0,\"lotteryCondition\":{},\"group\":{}},{\"prizeLevel\":\"一等奖\",\"stakeCount\":\"0\",\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"totalPrizeamount\":\"0\",\"sort\":101,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"101\"},{\"prizeLevel\":\"一等奖(追加)\",\"stakeCount\":\"0\",\"stakeAmount\":\"---\",\"stakeAmountFormat\":\"0\",\"totalPrizeamount\":\"0\",\"sort\":201,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"201\"},{\"prizeLevel\":\"二等奖\",\"stakeCount\":\"18\",\"stakeAmount\":\"318,368\",\"stakeAmountFormat\":\"318368\",\"totalPrizeamount\":\"5,730,624\",\"sort\":301,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"301\"},{\"prizeLevel\":\"二等奖(追加)\",\"stakeCount\":\"3\",\"stakeAmount\":\"191,020\",\"stakeAmountFormat\":\"191020\",\"totalPrizeamount\":\"573,060\",\"sort\":401,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"401\"},{\"prizeLevel\":\"三等奖\",\"stakeCount\":\"33\",\"stakeAmount\":\"11,545\",\"stakeAmountFormat\":\"11545\",\"totalPrizeamount\":\"380,985\",\"sort\":501,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"501\"},{\"prizeLevel\":\"四等奖\",\"stakeCount\":\"91\",\"stakeAmount\":\"3,000\",\"stakeAmountFormat\":\"3000\",\"totalPrizeamount\":\"273,000\",\"sort\":601,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"601\"},{\"prizeLevel\":\"五等奖\",\"stakeCount\":\"2,550\",\"stakeAmount\":\"500\",\"stakeAmountFormat\":\"500\",\"totalPrizeamount\":\"1,275,000\",\"sort\":701,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"701\"},{\"prizeLevel\":\"六等奖\",\"stakeCount\":\"8,330\",\"stakeAmount\":\"200\",\"stakeAmountFormat\":\"200\",\"totalPrizeamount\":\"1,666,000\",\"sort\":801,\"awardType\":0,\"lotteryCondition\":{},\"group\":\"801\"}],\"prizeLevelListRj\":[],\"termList\":[],\"termResultList\":[],\"ruleType\":0,\"vtoolsConfig\":{},\"surplusAmount\":\"\",\"surplusAmountRj\":\"\",\"lotteryPromotionFlagRj\":0,\"drawPdfUrl\":\"https://pdf.sporttery.cn/33800/07085/07085.pdf\",\"lotteryNotice\":1,\"lotteryDrawStatusNo\":\"\",\"lotteryNoticeShowFlag\":1}],\"pageNo\":1,\"pageSize\":10,\"pages\":10,\"total\":94}}";
        try {
            Map<String, Object> resultMap = new ObjectMapper().readValue(result, Map.class);
            System.out.println("resultMap = " + resultMap);

            JSONObject resultData = JSON.parseObject(result);
            JSONObject value = resultData.getJSONObject("value");
            int total = value.getIntValue("total");
//            int pages = value.getIntValue("pages");
            int pageNo = value.getIntValue("pageNo");
            int pageSize = value.getIntValue("pageSize");

            JSONArray list = value.getJSONArray("list");
            List<SuperLottery> superLotteries = list.toJavaList(SuperLottery.class);
            System.out.println("superLotteries = " + superLotteries.toString());

            if (CollectionUtils.isEmpty(superLotteries)) {
                log.error("--------------未更新到数据---------------");
                System.out.println("--------------未更新到数据---------------");
                return;
            }
            this.saveOrUpdateBatch(superLotteries);

            if (pageNo * pageSize < total) {
                try {
                    System.out.println("------------休息2秒------------");
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                pageNo++;
                queryParam.put("pageNo", pageNo);
                queryParam.put("pageSize", pageSize);
                pullSuperLotteryData(queryParam);

            }
            System.out.println("resultData = " + resultData);
        } catch (IOException e) {
            log.error("-----更新大乐透数据报错-----" + e.getMessage());
            e.printStackTrace();
        }

    }

    @Override
    @Transactional
    public void splitLotteryData(Map<String, Object> queryParam) {


        QueryWrapper<SuperLottery> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().orderByDesc(SuperLottery::getLotterydrawnum);

        String pageNo = String.valueOf(queryParam.get("pageNo") == null ? "1" : queryParam.get("pageNo"));
        String pageSize = String.valueOf(queryParam.get("pageSize") == null ? "20" : queryParam.get("pageSize"));
        Page<SuperLottery> page = new Page<>(Long.parseLong(pageNo), Long.parseLong(pageSize));
        IPage<SuperLottery> page1 = this.page(page, queryWrapper);
        List<SuperLottery> records = page1.getRecords();
        if (!CollectionUtils.isEmpty(records)) {
            for (SuperLottery record : records) {
                String result = record.getLotterydrawresult();
                String red = result.substring(0, 14).trim();
                String blue = result.substring(14).trim();
                System.out.println("result = " + result);
//                System.out.println("red =" + red);
//                System.out.println("blue =" + blue);
                record.setBlue(blue);
                record.setRed(red);
            }

        }

        this.updateBatchById(records);
    }

    @Override
    public void updateCurrentLotteryData(int count) {
        QueryWrapper<SuperLottery> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByDesc("lotteryDrawNum").last(" limit 1");
        SuperLottery one = this.getOne(queryWrapper);
        String currentNum = DateUtil.getDateFormat(new Date(), "yyyy").substring(2) + "200";
        if (!ObjectUtils.isEmpty(one)) {
            String lotterydrawnum = String.valueOf((Integer.parseInt(one.getLotterydrawnum()) + 1));
            HashMap<String, Object> queries = new HashMap<>();
            queries.put("pageSize", count < 1 ? 10 : count);
            queries.put("pageNo", "1");
            queries.put("startTerm", lotterydrawnum);//07001
            queries.put("endTerm", currentNum);//08001
            pullSuperLotteryData(queries);
            splitLotteryData(queries);
        }
    }


    public static void main(String[] args) {
        String currentNum = DateUtil.getDateFormat(new Date(), "yyyy").substring(2) + "200";
        System.out.println("currentNum = " + currentNum);
    }
}
